//
//  MYGPatientImageShareAlert.swift
//  MYDoctor
//
//  Created by Denny on 2024/5/6.
//

import UIKit

class MYGPatientImageShareAlert: UIView {

    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */
    var model = MYGPatientImages()
    var tapIMCompletion:((MYGPatientImages)->Void)?
    var tapPhoneCompletion:((MYGPatientImages)->Void)?

    var tapRenameCompletion:((MYGPatientImages)->Void)?

    @IBAction func toPhone(_ sender: Any) {
        if let c = tapPhoneCompletion {
            c(self.model)
        }
    }
    @IBAction func toIM(_ sender: Any) {
        let pasteboard = UIPasteboard.general
        var baseUrl = "\(shareUrl)/#/pages/examinationImages/examinationImages"
        if let user = MYGUserManager.user {
            let token = "?token=" + user.verification_token
            let id = "&id=" + "\(model.id)"
            baseUrl = baseUrl + token + id
        }
       
       
        pasteboard.string = baseUrl
        JFPopupView.popup.toast(hit: "已复制到剪切板")
        self.rootResponsder().popup.dismissPopup()
    }
    
    @IBAction func toQQ(_ sender: Any) {
//        let msg = UMSocialMessageObject.init()
//        let share = UMShareWebpageObject.shareObject(withTitle: "测试QQ", descr: "这是个链接", thumImage: nil)
//        share?.webpageUrl = "www.baidu.com"
//        msg.shareObject = share
//        UMSocialManager.default().share(to: UMSocialPlatformType.QQ, messageObject: msg, currentViewController: self.rootResponsder()) { Data, error in
//            if let er = error {
//                print(er)
//            }
//        }
    }
    
    @IBAction func toWechat(_ sender: Any) {
//        let msg = UMSocialMessageObject.init()
//        let share = UMShareWebpageObject.shareObject(withTitle: "测试微信", descr: "这是个链接", thumImage: nil)
//        share?.webpageUrl = "www.baidu.com"
//        msg.shareObject = share
//        UMSocialManager.default().share(to: UMSocialPlatformType.wechatSession, messageObject: msg, currentViewController: self.rootResponsder()) { Data, error in
//            if let er = error {
//                print(er)
//            }
//        }
    }
    
}
